package core;

/**
 * Created with IntelliJ IDEA.
 * User: admin
 * Date: 16.06.14
 * Time: 19:37
 * To change this template use File | Settings | File Templates.
 */
import java.util.Scanner;

public class Kvadrat {
    public static void main(String[] args)
    {
        System.out.println("Enter the first number");
        Scanner scan = new Scanner(System.in);
        double a, b, c, d;
        double x1, x2;
        a = scan.nextDouble();
        System.out.println("Enter the second number");
        b = scan.nextDouble();
        System.out.println("Enter the third number");
        c = scan.nextDouble();
        d = Math.pow(b, 2) - (4 * a * c);
        if (d > 0){
        x1 = ((-1*b) + Math.sqrt(d))/2;
        x2 = ((-1*b) - Math.sqrt(d))/2;
        System.out.println(x1);
        System.out.println(x2);
        }
        else if (d==0){
            x1 = (-1) * b;
            System.out.print(x1);
        }
        else
            System.out.print("Error. D < 0");
        }
    }

